package com.example.librarymanagementsystem2.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfigurer implements WebMvcConfigurer {
    //配置自己的静态资源所处的位置，根据计算机不同，位置不同
    @Value("D:\\study\\Web开发技术\\library-management-system2\\src\\main\\resources\\static\\")
    private String uploadPath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("file:"+ uploadPath);
    }
}
